<template>
  <router-view></router-view>
</template>
<script setup>
import { ref, onUnmounted } from "vue";
import screenfull from "screenfull";
onUnmounted(() => {
  screen();
});
const isFullscreen = ref(false);
const screen = () => {
  console.log("调用点击事件");
  if (!screenfull.enabled) {
    this.$message({
      message: "Your browser does not work",
      type: "warning",
    });
    return false;
  }
  screenfull.toggle();
  isFullscreen.value = true;
};
const checkFull = () => {
  let isFull = ref(
    document.fullscreenEnabled ||
      window.fullScreen ||
      documen.webkitIsFullScreen ||
      document.msFullscreenEnabled
  );
  if (isFull.value == undefined) {
    isFull.value = false;
  }
  return isFull.value;
};
window.onresize = () => {
  //   isFullscreen.value = false;
  document.onkeydown = function () {
    if (window.event.keyCode == 27) {
      //   screenfull.request();
      //   window.event.keyCode = 0;
      isFullscreen.value = false;
      window.event.return = false;
    }
    if (window.event.keyCode == 122) {
      //   screenfull.request();
      //   window.event.keyCode = 0;
      isFullscreen.value = false;
      window.event.return = false;
    }
  };
  // 全屏下监控是否按键了ESC
  //   console.log("按下了esc");
  //   screenfull.request();
  //   if (!checkFull()) {
  //     // 全屏下按键esc后要执行的动作
  // isFullscreen.value = false;
  //   }
};
// // 浏览器锁键盘
// document.onkeydown = () => {
//   screenfull.request();
//   if (window.event.keyCode < 10000) {
//     window.event.returnValue = false;
//     isFullscreen.value = false;
//     console.log(window.event.keyCode);
//   }
// };
</script>
<style>
#app {
  /* font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50; */
  /* margin-top: 60px; */
  /* margin: -8px;
  padding: 0; */
}
/* #app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
} */
html,
body {
  height: 100%;
  width: 100%;
  padding: 0;
  margin: 0;
}
/* *{
    box-sizing: border-box;
} */
</style>
